/**
 * 升级者配置生成器
 * source: 从指定矿中挖矿
 * target: 将其转移到指定的 roomController 中
 *
 * @param source 要挖的矿
 */
export = (sourceId: string): ICreepConfig => ({
    source: (creep: Creep) => {
        let spawn: Structure = Game.getObjectById<Structure>(sourceId);
        if (creep.withdraw(spawn, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) creep.moveTo(spawn)
    },
    // 升级控制器
    target: (creep: Creep) => {
        const controller: StructureController = creep.room.controller;
        if (creep.upgradeController(controller) == ERR_NOT_IN_RANGE) creep.moveTo(controller)
        // creep.moveTo(controller);

    },
    // 状态切换条件，稍后会给出具体实现
    switch: (creep: Creep) => creep.updateState()
});
